package org.leo.flow.exception;

import com.google.gson.JsonObject;

/**
 * 
 * Created on 2017年3月31日
 * <p>
 * Description 系统错误编码
 * <p>
 * Copyright xxx (c) 2019 .
 *
 * @author leo
 */
public enum ExceptionCode implements ExceptionEnums {

	_ERR(-1, "未知错误"), SYSTEM_ERR(00000, "系统错误");

	public int code;
	public String message;

	private ExceptionCode(int code, String message) {
		this.code = code;
		this.message = message;
	}

	@Override
	public int getCode() {
		return code;
	}

	@Override
	public String getMessage() {
		return message;
	}

	@Override
	public String toString() {
		JsonObject jsonObject = new JsonObject();
		jsonObject.addProperty("code", code);
		jsonObject.addProperty("message", message);
		return jsonObject.toString();
	}

	@Override
	public ExceptionEnums setCode(int code) {
		this.code = code;
		return this;
	}

	@Override
	public ExceptionEnums setMessage(String message) {
		this.message = message;
		return this;
	}

}